package com.ht.aems.fesmodel;

import java.io.Serializable;

/**
 * class AbstractUnit
 * <p> define methods for unit to be managed by IUnitManager <br>
 * unit can be station, division and rtu </p>
 *
 * @author Dong Shufeng
 * @version 1.0
 * Date: 2006-4-13
 */
public abstract class AbstractUnit implements Serializable {

    protected int id;

    protected String name = "";

    protected int parentUnitId = -1;  

    protected AbstractUnit(int id) {
        this.id = id;
    }

    protected AbstractUnit() {
    }

    protected AbstractUnit(int id, String name) {
        this.id = id;
        this.name = name;
    }

    protected AbstractUnit(int id, String name, int parentUnitId) {
        this.id = id;
        this.name = name;
        this.parentUnitId = parentUnitId;
    }

    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getParentUnitId() {
        return parentUnitId;
    }

    public void setParentUnitId(int parentUnitId) {
        this.parentUnitId = parentUnitId;
    }

    public boolean equals(Object obj) {
        if(obj instanceof AbstractUnit) {
            AbstractUnit another = (AbstractUnit)obj;
            if(another.getId() == this.getId())
                return true;
        }
        return false;
    }
}